# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Enrico Morelli <morelli@cerm.unifi.it>

pkgname=openmotif
pkgver=2.3.8
pkgrel=3
pkgdesc="Open Motif"
arch=('loong64' 'x86_64')
url="https://motif.ics.com/"
license=('LGPL')
depends=(libxp libxft libxmu libpng libjpeg)
makedepends=(xbitmaps xorgproto)
conflicts=(lesstif)
source=("https://downloads.sourceforge.net/project/motif/Motif%20$pkgver%20Source%20Code/motif-$pkgver.tar.gz"
         no-demos.patch)
sha256sums=('859b723666eeac7df018209d66045c9853b50b4218cecadb794e2359619ebce7'
            'ff55064ab36dba411599c9abef122b26d694ee11fd1d371378be08497448668c')

prepare() {
  cd motif-$pkgver
  patch -p1 -i ../no-demos.patch # Don't build demos
  touch NEWS AUTHORS
  autoreconf -if
}

build() {
  cd motif-$pkgver
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd motif-$pkgver
  make DESTDIR="$pkgdir" install
}
